// pages/pillow/pillow.js
Page({
  data: {
    closeFnType:false,
    closeAlertFnType:false,
    currentList:0,
    list:[
      {icon:'../../assets/settings/study-active.png',text:'学习睡姿',index:0},
      {icon:'../../assets/settings/measure-inactive.png',text:'科学测算高度',index:1},
      {icon:'../../assets/settings/comfor-active.png',text:'测试舒适枕高',index:2},
      {icon:'../../assets/settings/alert-active.png',text:'缺电报警',index:3},
    ],
  },
  init(){
  
  },
  changeTabFn(item){
    let {index} = item.currentTarget.dataset.item;
    this.setData({
      currentList:index,
    })
  },
  comforYwFn(setCon){
    this.triggerEvent('comforYwFn',setCon)
  },
  comforCwFn(setCon){
    this.triggerEvent('comforCwFn',setCon)
  },
  alertSetFn(setCon){
    this.triggerEvent('alertSetFn',setCon)
  },
  pillowSetFn(){
    this.setData({
      currentList:1,
    })
  },
  studyFn(setCon){
    this.triggerEvent('studyFn',setCon)
  },
  setMeasureFn(setCon){
    this.triggerEvent('setMeasureFn',setCon)
  },
  closeFn(){
    this.setData({
      closeFnType:true
    })
  },
  closeAlertFn(){
    this.setData({
      closeAlertFnType:true
    })
  },
  studyChildFn(cmd){
    let child = this.selectComponent('#studyActive');
    if(child){
      child.studyChildFn(cmd);
    }
  },
});
